#ifndef DOUBAN_MINIBLOG_EVENTVIEWER_H
#define DOUBAN_MINIBLOG_EVENTVIEWER_H

#include <QFrame>
#include <QButtonGroup>
#include <QPushButton>
#include <QTextBrowser>
#include <QXmlStreamReader>
#include <QMovie>
#include <QLabel>
class QNetworkReply;

namespace Douban
{
	class MiniBlogEntry;
	class DoubanContext;
	class EventViewer : public QFrame
	{
		Q_OBJECT
		public:
			void viewEntry(MiniBlogEntry*);



			EventViewer(DoubanContext*);
			~EventViewer();
		protected:
			void closeEvent(QCloseEvent* );
		private:
			QPushButton		gotoWebBtn;
			QLabel			titleLabel;
			QLabel			iconLabel;
			QLabel			infoLabel;
			QTextBrowser		summaryText;
			QPushButton		wishBtn;
			QPushButton		joinBtn;
			QLabel			hintLabel;
			QLabel			timeLabel;
			QLabel			statusLabel;

			DoubanContext*	m_context;
			QLabel			m_loadingLabel;
			QMovie			m_loadingMovie;
			QXmlStreamReader	m_xmlParser;
			MiniBlogEntry*	m_currentEntry;
			QNetworkReply*	r_getEventReply;
			QNetworkReply*	r_interestReply;
			QNetworkReply*	r_joinReply;

			void cleanup();
			void showLoading();
			void hideLoading();
			void updateInfo();
		private slots:
			void onGotEventInfo();
			void gotoWeb();
			void doInterest();
			void doJoin();

			void onInterestFinished();
			void onJoinFinished();

			void openUrl(const QString&);
	};
}
#endif // EVENTVIEWER_H
